<template>
	<view class="mainpadding2">
		<view class="mainpadding_top ffffff radius" v-for="(item,index) in list.data" :key="item.id">
			<view class="flexleft">
				<image src="../static/logo.jpg" class="margin_right3" style="width: 120rpx;height: 120rpx;border-radius: 50%;" mode=""></image>
				<view class="flexcolumnbet" style="height: 120rpx;">
					<view class="titletext fonweight xiaohei">{{item.nickname}}</view>
					<view class="smalltext xiaohui">{{item.mobile}}</view>
					<view class="smalltext xiaohui">{{item.rec_time_text}}</view>
				</view>
			</view>
			<view class="margin_top" style="padding: 20rpx 30rpx;background-color: #f1f1f1;border-radius: 10rpx;">
				<view class="ershil fonweight xiaohei">累计业绩：<text style="color: #ba9549;">￥{{item.total_price}}</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/user/myTeam', 'GET', {
					page: page || 1,
					limit: 12,
				}).then(res => {
					uni.stopPullDownRefresh()
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>
page{
	background-color: #fafafa;
}
</style>
